/*  1:   */package com.linkage.bss.commons.dao;
/*  2:   */
/*  3:   */import java.sql.SQLException;
/*  4:   */import org.springframework.jdbc.UncategorizedSQLException;
/*  5:   */
/* 12:   */public class DBUtil
/* 13:   */{
/* 14:14 */  private static ThreadLocal local = new ThreadLocal();
/* 15:   */  
/* 19:   */  public static boolean isPackageDiscarded(Exception e)
/* 20:   */  {
/* 21:21 */    return isOraclePackageDiscarded(e);
/* 22:   */  }
/* 23:   */  
/* 28:   */  private static boolean isOraclePackageDiscarded(Exception e)
/* 29:   */  {
/* 30:30 */    if (e == null) {
/* 31:31 */      return false;
/* 32:   */    }
/* 33:33 */    if ((e instanceof SQLException)) {
/* 34:34 */      SQLException e1 = (SQLException)e;
/* 35:35 */      return isDiscardedSQLException(e1);
/* 36:   */    }
/* 37:   */    
/* 38:38 */    if ((e instanceof UncategorizedSQLException)) {
/* 39:39 */      SQLException e1 = ((UncategorizedSQLException)e).getSQLException();
/* 40:40 */      return isDiscardedSQLException(e1);
/* 41:   */    }
/* 42:42 */    return false;
/* 43:   */  }
/* 44:   */  
/* 49:   */  private static boolean isDiscardedSQLException(SQLException e1)
/* 50:   */  {
/* 51:51 */    return ("72000".equals(e1.getSQLState())) && ((e1.getErrorCode() == 4061) || (e1.getErrorCode() == 4068) || (e1.getErrorCode() == 6508));
/* 52:   */  }
/* 53:   */  
/* 55:   */  public static void setTargetDataSource(String dataSource)
/* 56:   */  {
/* 57:57 */    local.set(dataSource);
/* 58:   */  }
/* 59:   */  
/* 60:   */  public static String getTargetDataSource() {
/* 61:61 */    return (String)local.get();
/* 62:   */  }
/* 63:   */}


/* Location:           E:\workspace\sungl111\workspace_promotion\BizHallConfig\WebRoot\WEB-INF\lib\bss.commons-0.1.jar
 * Qualified Name:     com.linkage.bss.commons.dao.DBUtil
 * JD-Core Version:    0.7.0-SNAPSHOT-20130630
 */